package creation_patterns.abstruct_factory_pattern;

import creation_patterns.abstruct_factory_pattern.abstract_product.OperationController;
import creation_patterns.abstruct_factory_pattern.abstract_product.UIController;
import creation_patterns.abstruct_factory_pattern.concrete_factory.XiaomiAndroidFactory;
import creation_patterns.abstruct_factory_pattern.concrete_factory.IphoneISOFactory;
import creation_patterns.abstruct_factory_pattern.concrete_product.android.xiaomi.XiaomiOperationController;

public class Test {
    public static void main(String[] args) {

        // 多态（父类的引用指向子类的对象）的调用规则为：先去父类中查看是否存在同名方法定义，如果存在调用子类的实现，如果不存在直接报错
        XiaomiAndroidFactory androidFactory = new XiaomiAndroidFactory();
        OperationController operationControllerBean = androidFactory.getOperationControllerBean();
//        多态调用 -> 接口中的方法
        operationControllerBean.control();
        UIController uiControllerBean = androidFactory.getUIControllerBean();
        uiControllerBean.display();


        IphoneISOFactory isoFactory = new IphoneISOFactory();
        OperationController isoFactoryOperationControllerBean = isoFactory.getOperationControllerBean();
        isoFactoryOperationControllerBean.control();
        UIController isoFactoryUIControllerBean = isoFactory.getUIControllerBean();
        isoFactoryUIControllerBean.display();

//        直接调用  -> 是抽象类中的方法
        XiaomiOperationController xiaomiOperationController = new XiaomiOperationController();
        xiaomiOperationController.control();



    }
}
